package com.ly.cyclictest.test02;

public class BarrierRun implements Runnable {
    int N;

    boolean flag = false;

    public BarrierRun(int N){
        this.N = N;
        System.out.println("司令:集合");
    }
    @Override
    public void run() {
        if(flag){
            System.out.println("司令:"+N+"个士兵返回");
        }else{
            System.out.println("司令:"+N+"个士兵开始执行任务");
            flag = true;
        }
    }
}
